{% extends "bootstrap/base.html" %}

{% block title %}登录 - 学生信息系统{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <h2>用户登录</h2>
            
            {% with messages = get_flashed_messages() %}
                {% if messages %}
                    {% for message in messages %}
                        <div class="alert alert-warning" role="alert">{{ message }}</div>
                    {% endfor %}
                {% endif %}
            {% endwith %}
            
            <form method="POST">
                {{ form.hidden_tag() }}
                
                <div class="form-group">
                    {{ form.username.label(class="control-label") }}
                    {{ form.username(class="form-control") }}
                    {% for error in form.username.errors %}
                        <span class="text-danger">{{ error }}</span>
                    {% endfor %}
                </div>
                
                <div class="form-group">
                    {{ form.password.label(class="control-label") }}
                    {{ form.password(class="form-control") }}
                    {% for error in form.password.errors %}
                        <span class="text-danger">{{ error }}</span>
                    {% endfor %}
                </div>
                
                <div class="form-group">
                    <div class="checkbox">
                        <label>
                            {{ form.remember_me() }} {{ form.remember_me.label.text }}
                        </label>
                    </div>
                </div>
                
                <div class="form-group">
                    {{ form.submit(class="btn btn-primary btn-block") }}
                </div>
            </form>
            
            <p class="text-center">
                还没有账户？<a href="{{ url_for('auth.register') }}">立即注册</a>
            </p>
        </div>
    </div>
</div>
{% endblock %}